package cn.csc.module.distribute.controller.app.audit;

import cn.csc.framework.common.pojo.CommonResult;
import cn.csc.framework.security.core.util.SecurityFrameworkUtils;
import cn.csc.module.distribute.service.audit.DistributorAuditService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.math.BigInteger;

/**
 * @author liuchuang
 * @version 1.0
 * @modify
 * @since 2025/5/9 9:56
 */
@Api(tags = "APP用户 - 分销员审核记录")
@RestController
@RequestMapping("/distribute/distributor-audit")
@Validated
public class AppDistributorAuditController {

    @Resource
    private DistributorAuditService distributorAuditService;

    /**
     * 更新当前用户的审核记录为已读
     */
    @GetMapping("/updateHasRead")
    @ApiOperation("更新当前用户的审核记录为已读")
    public CommonResult<Long> updateHasRead() {
        Long userId = SecurityFrameworkUtils.getLoginUserId();
        distributorAuditService.updateByUserId(BigInteger.valueOf(userId));
        return CommonResult.success();
    }

}
